#define _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    string reverseStr(string s, int k) {
        for (size_t i = 0; i < s.size(); i += 2 * k)
        {
            if (i + k <= s.size())
            {
                reverse(s.begin() + i, s.begin() + i + k);
            }

            if (i + k > s.size())
            {
                reverse(s.begin() + i, s.begin() + s.size());
            }
        }
        return s;
    }
};